package models

import "gorm.io/gorm"

type Brand struct {
	gorm.Model
	Name       string  `json:"name"`
	db         *gorm.DB `json:"-"`
}

func (Brand) TableName() string {
	return "products"
}
func (p *Brand) FindByID(product_id uint) (model *Brand, err error) {
	model = &Brand{}
	result := p.db.First(model)
	err = result.Error
	return
}

func (p Brand) FindByBrandID(page, rows int, category_id uint) (pages Pages, error error) {
	panic("implement me")
}

type IBrand interface {
	FindByID(product_id uint) (*Brand, error)
	FindByBrandID(page, rows int, category_id uint) (pages Pages, error error)
}

func NewBrand(db *gorm.DB) IBrand {
	return &Brand{db:db}
}
